<% layout('/layouts/default.html', {title: '任务部署信息表-任务类型管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
<!--			<div class="box-title">-->
<!--				<i class="fa icon-notebook"></i> ${text('任务部署信息表-任务类型管理')}-->
<!--			</div>-->
			<#form:form id="searchForm" model="${dcSupTaskInfoDict}" action="${ctx}/dict/dcSupTaskInfoDict/listData" method="post" class="form-inline"
			data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
			<div style="float: right">
				<div class="form-group">
					<label class="control-label">${text('字典标签')}：</label>
					<div class="control-inline">
						<#form:input path="dictLabel" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('字典键值')}：</label>
					<div class="control-inline">
						<#form:input path="dictValue" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('字典类型')}：</label>
					<div class="control-inline width-120">
						<#form:select path="dictType" dictType="dc_dict_type" blankOption="true" class="form-control width-120" />
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('状态')}：</label>
					<div class="control-inline width-120">
						<#form:select path="dictStatus" dictType="sys_search_status" blankOption="true" class="form-control width-120" />
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button onclick="cz();" class="btn btn-default btn-sm">${text('重置')}</button>
					<a href="${ctx}/dict/dcSupTaskInfoDict/form" class="btn btn-default btnTool" title="${text('新增任务类型')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
				</div>
			</div>
		</#form:form>
		</div>
		<div class="box-body">
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
	//重置
	function cz(){
		searchForm.reset();
		$('#dataGrid').dataGrid('reloadGrid');
	}
	// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	sortableColumn: false, // 列表不允许排序
	columnModel: [
		{header:'${text("主键")}', name:'id', index:'a.id', width:150, align:"left", hidden:true},
		{header:'${text("字典标签")}', name:'dictLabel', index:'a.dict_label', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
			return '<a href="${ctx}/dict/dcSupTaskInfoDict/form?id='+row.id+'" class="btnList" data-title="${text("编辑任务类型")}">'+(val||row.id)+'</a>';
		}},
		{header:'${text("字典键值")}', name:'dictValue', index:'a.dict_value', width:150, align:"left"},
		{header:'${text("字典类型")}', name:'dictType', index:'a.dict_type', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('dc_dict_type')}, val, '${text("未知")}', true);
		}},
		{header:'${text("排序")}', name:'dictSort', index:'a.dict_sort', width:150, align:"center"},
		{header:'${text("状态")}', name:'dictStatus', index:'a.dict_status', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('sys_search_status')}, val, '${text("未知")}', true);
		}},
		{header:'${text("更新时间")}', name:'updateDate', index:'a.update_date', width:150, align:"center"},
		// {header:'${text("备注")}', name:'remarks', index:'a.remarks', width:150, align:"left"},
		{header:'${text("操作")}', name:'actions', width:250, align:"center", formatter: function(val, obj, row, act){
			var actions = [];
				if(row.createBy  == '${@UserUtils.getUser().getUserCode()}') {
					actions.push('<a href="${ctx}/dict/dcSupTaskInfoDict/form?id=' + row.id + '" class="btn btn-primary btn-xs btnList" title="${text("编辑任务类型")}">编辑</a>&nbsp;');
				}
				if (row.dictStatus == Global.STATUS_NORMAL){
					actions.push('<a href="${ctx}/dict/dcSupTaskInfoDict/disable?id='+row.id+'" class="btn btn-warning btn-xs btnList" title="${text("停用任务类型")}" data-confirm="${text("确认要停用该任务类型吗？")}">停用</a>&nbsp;');
				} else if (row.dictStatus == Global.STATUS_DISABLE){
					actions.push('<a href="${ctx}/dict/dcSupTaskInfoDict/enable?id='+row.id+'" class="btn btn-success btn-xs btnList" title="${text("启用任务类型")}" data-confirm="${text("确认要启用该任务类型吗？")}">启用</a>&nbsp;');
				}
		if(row.createBy  == '${@UserUtils.getUser().getUserCode()}') {
			actions.push('<a href="${ctx}/dict/dcSupTaskInfoDict/delete?id=' + row.id + '" class="btn btn-danger btn-xs btnList" title="${text("删除任务类型")}" data-confirm="${text("确认要删除该任务类型吗？")}">删除</a>&nbsp;');

		}
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>